package com.chinanet.config;

import com.chinanet.quartz.ModelInspectJob;
import org.quartz.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class QuartzConfig {
    @Bean
    public JobDetail modelInspectJobDetail() {
        return JobBuilder.newJob(ModelInspectJob.class).withIdentity("modelInspectJob").storeDurably().build();
    }

    @Bean
    public Trigger uploadTaskTrigger() {
        CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule("*/30 * * * * ?");
        return TriggerBuilder.newTrigger().forJob(modelInspectJobDetail())
                .withIdentity("modelInspectJob")
                .withSchedule(scheduleBuilder)
                .build();
    }
}